package com.itheima.eurekafeignclient.controller;


import com.itheima.eurekafeignclient.entity.User;
import com.itheima.eurekafeignclient.service.FeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@CrossOrigin
@RestController
public class ConsumerController {
    @Autowired
    FeignService helloService;

    @GetMapping(value = "/hello")
    public String hello() {
        return helloService.sayHello();
    }

    @GetMapping(value = "/hello1")
    public String hello(@RequestParam String name) {
        return helloService.sayHello(name);
    }

    @GetMapping(value = "/hello2")
    public String hello(@RequestParam String username,@RequestHeader(value = "age") Integer age) {
        return helloService.sayHello(username,age);
    }

    @PostMapping(value = "/hello3" )
    public String hello3( User user) {
        System.out.println("user=="+user);
        return helloService.sayHello2(user);
    }

    @PostMapping(value = "/hello4" )
    public String hello(@RequestBody User user) {
        System.out.println(user);
        return helloService.sayHello(user);
    }

}
